package com.huang.eduservice.controller.front;

import com.huang.eduservice.entity.EduCourse;
import com.huang.eduservice.entity.EduTeacher;
import com.huang.eduservice.service.EduCourseService;
import com.huang.eduservice.service.EduTeacherService;
import com.hunag.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("eduservice/indexfront")
public class IndexFrontController {
    @Autowired
    private EduTeacherService teacherService;
    @Autowired
    private EduCourseService courseService;


    //前八条热门课程  前4名师
    @GetMapping("index")
    public R getindex(){
      List<EduTeacher> teachers= teacherService.getTeaIndex();
      List<EduCourse> courses=courseService.getCouIndex();
        return R.ok().data("teachers",teachers).data("courses",courses);
    }

}
